<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" href="/Sys/css/layui.css">
    <link rel="stylesheet" href="/Sys/css/sign.css">

    <link rel="stylesheet"
          href="/Sys/js/css/modules/layui-icon-extend/iconfont.css">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="/Sys/css/font.css">
    <link rel="stylesheet" href="/Sys/css/xadmin.css">
    <script type="text/javascript"
            src="/Sys/js/jquery-3.3.1.min.js"></script>
    <script src="/Sys/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
    <script type="text/javascript" src="/Sys/js/jquery.table2excel.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">演示</a>
        <a>
          <cite>导航元素</cite></a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <div class="layui-row">


        <!-- <div class="demoTable" style="margin-bottom: 20px">-->
        <!--  搜索姓名：-->
        <!--  <div class="layui-inline">-->
        <!--    <input class="layui-input" name="id" id="demoReload" autocomplete="off">-->
        <!--  </div>-->
        <!--  <button class="layui-btn" data-type="reload" ><i class="layui-icon">&#xe615;</i></button>-->
    </div>


</div>

<table id="test" lay-filter="test"></table>
</div>
</body>


<script th:inline="javascript">
    var documentWidth = $(document).width();
    layui.use('table', function () {
        var table = layui.table;
        var name = [[${session.name}]]
        console.log(name)
        table.render({
            elem: '#test'  //绑定table表格
            , id: 'stuInfo'
            , method: 'post'
            , url: 'getStuByName' //后台springmvc接收路径
            ,where: {
                key: {
                    id: name
                }
            }
            , cols: [
                [
                    {field: 'stuno', title: '学号', sort: true}
                    , {field: 'name', title: '姓名'}
                    , {field: 'sex', title: '性别'}
                    , {field: 'age', title: '年龄'}

                    /* ,{field: 'photo', title: '用户头像',templet:'<a><img src="../uploads/{{d.photo}}"></a>'
                        ,edit: 'file'} */
                ]
            ]
        });


        var $ = layui.$, active = {
            reload: function () {
                var demoReload = $('#demoReload');
                table.reload('stuInfo', {
                    page: {
                        curr: 1 //重新从第 1 页开始
                    },
                    url: 'getStuByName'
                    , where: {
                        key: {
                            id: demoReload.val()
                        }
                    }
                    , method: 'post'
                });
            }
        };

        $('.demoTable .layui-btn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });

    });


    layui.use(['form', 'layer', 'table', 'upload'], function () {
        var table = layui.table
            , form = layui.form, upload = layui.upload;
        var uploadInst = upload.render({
            elem: '#uploadExcel'
            , exts: "xls"
            , url: '/Sys/ImportStu'
        });

    })


</script>

</html>